//
//  KaiJiangSevenCell.m
//  HomeDemo
//
//  Created by liGordon on 17/3/30.
//  Copyright © 2017年 ZJNY. All rights reserved.
//

#import "KaiJiangSevenCell.h"

@implementation KaiJiangSevenCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    for(UIView *numView in self.NumView){
        numView.layer.cornerRadius = 15;
        numView.layer.masksToBounds = YES;
    }
    for(UILabel *numLabel in self.Numlabel){
        NSMutableArray* Valuearr=[NSMutableArray new];
        int counN=30;
        for(int i=0;i<counN;i++)
        {
            int value = arc4random() % 30;
            for(int j=0;j<Valuearr.count;j++)
            {
                NSString* s=Valuearr[j];
                while([s intValue]==value)                 {
                    value = arc4random() % 30;
                    j=-1;
                }
            }
            [Valuearr addObject:[NSString stringWithFormat:@"%d",value]];
        }
        self.numArr  =  Valuearr;
        for (int i = 0; i<29; i++) {
               numLabel.text = [NSString stringWithFormat:@"%@",Valuearr[i]];
        }
       
        
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(NSArray *)randomArray
{
    //随机数从这里边产生
    NSMutableArray *startArray=[[NSMutableArray alloc] initWithObjects:@0,@1,@2,@3,@4,@5,@6,@7,@8,@9,@10,@11,@12,@13,@14,@15,@16,@17,@18,@19,@20,@21, nil];
    //随机数产生结果
    NSMutableArray *resultArray=[[NSMutableArray alloc] initWithCapacity:0];
    //随机数个数
    NSInteger m=21;
    for (int i=0; i<m; i++) {
        int t=arc4random()%startArray.count;
        resultArray[i]=startArray[t];
        startArray[t]=[startArray lastObject]; //为更好的乱序，故交换下位置
        [startArray removeLastObject];
    }
    return resultArray;
}

@end
